<?php 
	include '../init.php';
	$model=new Model('user');

	$a=$_GET['a'];

	switch ($a) 
	{
		case 'edit':
			$id=$_GET['id'];

			$data['pwd']=md5('123456shan');
			$where['id']=$id;

			$res=$model->update($data,$where);
			if ($res) 
			{
				success('修改完毕！',ADMIN_URL.'/user/index.php',2);
				return false;
			}
			break;
		
		case 'up':
			//接受当前页
			$p=$_GET['p'];

			$where['id']=$_GET['id'];
			$status=$model->select($where);

			/*if ($status[0]['status']==0) 
			{
				$data['status']=1;
			}else{
				$data['status']=0;
			}*/

			$data['status']=$status[0]['status']==0?1:0;

			$res=$model->update($data,$where);
			if ($res) 
			{
				header('location:'.ADMIN_URL.'/user/index.php?p='.$p);
			}
			break;

		case 'del':
			$id=$_GET['id'];
			$res=$model->delete($id);
			if ($res) 
			{
				header('location:'.ADMIN_URL.'/user/index.php');
			}
			break;
			
	}
?>